package dS.ProjectGPS.LeicaOWI;

import javax.microedition.lcdui.*;

public class FormOwiCUT extends Form implements FormOwi {
  TextField cutoff = new TextField("Cut-off Elevation", "", 2, TextField.NUMERIC);
  OWIAgent owiAgent = null;

  public FormOwiCUT(OWIAgent o) {
    super("Satellite Cut-off");

    owiAgent = o;

    try {
      ndsInit();
    }
    catch (Exception ex) {
    }
  }

  public void ndsInit() throws Exception {
    append(cutoff);

  }

  public void update() {
    owiAgent.query(OWI.qsCUT());

    cutoff.setString(OWI.cutCutoffElevation);
  }

  public void save() {
    String msgId = "CUT";

    // Setup SET parameters
    String[] outputs = {msgId,
                       cutoff.getString(),
    };

    //Send message and update form if successful
    int ackCode = (owiAgent.set(msgId, OWI.setMessage(outputs)));
    Controller.showACKAlert(this,this,ackCode);

  }
}
